public class FizzBuzz {

    private int num;

    public FizzBuzz(int num) {
        if(num < 1 || num > 100) {
            throw new IllegalArgumentException("无效输入");
        }
        this.num = num;
    }

    public String fizzBuzz() {
        StringBuilder strBui = new StringBuilder();
        if(num % 3 == 0 || String.valueOf(num).contains("3")) {
            strBui.append("Fizz");
        }
        if (num % 5 == 0 || String.valueOf(num).contains("5")) {
            strBui.append("Buzz");
        }
        if(strBui.length() == 0) {
            strBui.append(num);
        }
        return strBui.toString();
    }
}
